#!/bin/bash

if test -e "resultats.txt"
then
	rm resultats.txt
fi

ls "./gradient"| grep "pgm" >aux
L=1
IFS=$'\n'
for ligne in $(cat aux)
do

#!Image du gradiant

gradiant=$ligne


#!Image de reférence

dirpah="./gradient"
cd $dirpah 2> /dev/null
prefix=$( ls $gradiant |cut -d '_' -f 1)
type=$( ls $gradiant |cut -d '_' -f 2)
reference=$( ls "../reference" | grep $prefix)


#!Affichage des resultats
echo $L".	Type de Detection :" $type>> ../resultats.txt
echo "	Image Gradiant    :" $ligne>> ../resultats.txt
echo "	Image Reférence   :" $reference>> ../resultats.txt

#!Comparaison des images
../Contour "../gradient/"$gradiant -compare "../reference/"$reference >> ../resultats.txt

echo "	">> ../resultats.txt
echo "// *************************************************//">> ../resultats.txt
echo "	">> ../resultats.txt
L=$(expr $L + 1)
done
rm ../aux
exit 0
